#!/usr/bin/env python3
# -*-coding: utf-8-*-

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from time import sleep 

# driver = webdriver.Firefox()
driver = webdriver.Chrome()

driver.get('https://www.baidu.com')

el = WebDriverWait(driver, 5).until(EC.presence_of_element_located((By.ID, 'kw')))
js = "arguments[0].style.border='2px solid red'"
driver.execute_script(js, el)
el.send_keys('葛木瓜')
driver.find_element_by_id('su').submit()

# driver.implicitly_wait(3)

while True:
    
    if '葛木瓜' not in driver.title:
        sleep(1)
    else:
        break
print(driver.title)

